package com.co.ud.icehome.connector;

import javax.jms.JMSException;

import org.apache.log4j.Logger;

public class RequestConnectorActiveMQ {

	private static RequestConnectorActiveMQ requestConnectorActiveMQ;
	private SimpleProducer simpleProducer=null;
	private Logger logger = Logger.getLogger(this.getClass());
	
	private RequestConnectorActiveMQ (){
		
		this.simpleProducer=new SimpleProducer();
		
		
	}
	
	public static  RequestConnectorActiveMQ getInstance(){

	System.out.println("instanciando.....");
		if(requestConnectorActiveMQ==null){
			requestConnectorActiveMQ=new RequestConnectorActiveMQ();
			
		}
		
		System.out.println("finaliza instanciacion");	
		return requestConnectorActiveMQ;
		
		
		
	}
	
	
	public void sendMessage(String msg){
		logger.info("send message");
		
		try {
			this.simpleProducer.sendMessage(msg);
		} catch (JMSException e) {
			// TODO Auto-generated catch block
			logger.error(e);
		}
	}
	
	
	
}
